﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RadioThermostat
{
    //"{""temp"":44.50,""tmode"":0,""fmode"":2,""override"":0,""hold"":0,""tstate"":0,""fstate"":1,""time"":{""day"":6,""hour"":18,""minute"":30},""t_type_post"":0}";
    public class RTTstat
    {
        public string Temp { get; set; }
        public int Tmode { get; set; }
        public int Fmode { get; set; }
        public string Override { get; set; }
        public string Hold { get; set; }
        public string T_heat { get; set; }
        public string T_cool { get; set; }
        public int Tstate { get; set; }
        public int Fstate { get; set; }
        public Dictionary<string,int> Time { get; set; }

        public int TIME_DAY
        {
            get
            {
                return Time["day"];
            }
        }

        public int TIME_HOUR
        {
            get
            {
                return Time["hour"];
            }
        }

        public int TIME_MINUTE
        {
            get
            {
                return Time["minute"];
            }
        }

        public DateTime LocalTime
        {
            get
            {
                DateTime now = DateTime.Now;
                return new DateTime(now.Year, now.Month, TIME_DAY, TIME_HOUR, TIME_MINUTE, 0);                
            }
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("temp=" + Temp + "|");
            sb.Append("Tmode=" + (TempMode)Tmode + "|");
            sb.Append("Fmode=" + (FanMode)Fmode + "|");
            sb.Append("Override=" + Override + "|");
            sb.Append("Hold=" + Hold + "|");
            sb.Append("T_heat=" + T_heat + "|");
            sb.Append("T_cool=" + T_cool + "|");
            sb.Append("Tstate=" + (TState)Tstate + "|");
            sb.Append("Fstate=" + (FState)Fstate);
        
            return sb.ToString();
        }
    }
}
